
from curl_cffi import requests
import pymysql

con = pymysql.connect()



cookies = {
    'XSRF-TOKEN': '317e7e8e-fa08-417b-9785-79bff7b5f4dc',
    'cna': 'fp+MITM4jQQBASQIgiAV1f/z',
    'xlly_s': '1',
    'isg': 'BH5-hFeAmyy1dM8I6Yi3wFlZz5TAv0I5OCGFHiiG50G8yx6lkEx7SaUoR5cHdzpR',
    'tfstk': 'gATEnp1OO23Eb3ysRdQzg0VoHc_dyakjaU65ZQAlO9XhdXQPqLvhqUipOauPQLI5K9GdzgvkKgv5FBNpXKO0ReidPz7dyaDjhqgXOBQRrmY_M8XpsCCo16bEUpXAyaDjCqgX9BQJLH5DK9Ai__17-JvlKG4GBsZhr9juIlfcITbkEM2GS_fztJjhK1cNwOfhrMX3Sf55I6blrLAi__HZyEY8Q_sn1EsRnCwi2GWDtOzuuSChxJdgVz4oP1SFnMDQzz5GTMWDtOkEI5qNjQIyy7UPVBxvesv3KYWJ7CYHmKD_A9xVaItynbZd1g8d7TYnkSWM8Q8Nvhw3xs7FLiYhYSGv9gxw7wTneod6_9jV5hitdg_eLnBAxcH9UCWBEeSgLA6WcCThbKD_7LIyqe_M-A0V46yRscTHyHyu4MfO_tGZ_Pd2p1cjVoq42uIK91WjtMq82Mf0Pk8SLuERvB1NhXVl.',
}

headers = {
    'accept': 'application/json, text/plain, */*',
    'accept-language': 'zh-CN,zh;q=0.9',
    'priority': 'u=1, i',
    'referer': 'https://search.damai.cn/search.htm',
    'sec-ch-ua': '"Google Chrome";v="141", "Not?A_Brand";v="8", "Chromium";v="141"',
    'sec-ch-ua-mobile': '?0',
    'sec-ch-ua-platform': '"Windows"',
    'sec-fetch-dest': 'empty',
    'sec-fetch-mode': 'cors',
    'sec-fetch-site': 'same-origin',
    'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36',
    'x-xsrf-token': '317e7e8e-fa08-417b-9785-79bff7b5f4dc',
    # 'cookie': 'XSRF-TOKEN=317e7e8e-fa08-417b-9785-79bff7b5f4dc; cna=fp+MITM4jQQBASQIgiAV1f/z; xlly_s=1; isg=BH5-hFeAmyy1dM8I6Yi3wFlZz5TAv0I5OCGFHiiG50G8yx6lkEx7SaUoR5cHdzpR; tfstk=gATEnp1OO23Eb3ysRdQzg0VoHc_dyakjaU65ZQAlO9XhdXQPqLvhqUipOauPQLI5K9GdzgvkKgv5FBNpXKO0ReidPz7dyaDjhqgXOBQRrmY_M8XpsCCo16bEUpXAyaDjCqgX9BQJLH5DK9Ai__17-JvlKG4GBsZhr9juIlfcITbkEM2GS_fztJjhK1cNwOfhrMX3Sf55I6blrLAi__HZyEY8Q_sn1EsRnCwi2GWDtOzuuSChxJdgVz4oP1SFnMDQzz5GTMWDtOkEI5qNjQIyy7UPVBxvesv3KYWJ7CYHmKD_A9xVaItynbZd1g8d7TYnkSWM8Q8Nvhw3xs7FLiYhYSGv9gxw7wTneod6_9jV5hitdg_eLnBAxcH9UCWBEeSgLA6WcCThbKD_7LIyqe_M-A0V46yRscTHyHyu4MfO_tGZ_Pd2p1cjVoq42uIK91WjtMq82Mf0Pk8SLuERvB1NhXVl.',
}

params = {
    'keyword': '',
    'cty': '',
    'ctl': '',
    'sctl': '',
    'tsg': '0',
    'st': '',
    'et': '',
    'order': '1',
    'pageSize': '30',
    'currPage': '1',
    'tn': '',
}


for i in range(1,2):
    url = f"https://search.damai.cn/searchajax.html?keyword=&cty=&ctl=&sctl=&tsg=0&st=&et=&order=1&pageSize=30&currPage={i}&tn="
    responses = requests.get(url, params=params, cookies=cookies, headers=headers)
    datas = responses.json()['pageData']['resultData']
    for data in datas:
        # print(data)
        print(data["actors"],data["name"])